import VueRouter from "vue-router";
import Vue from "vue";
import LoginUser from "@/views/login.vue"
import HomePage from "@/views/home.vue"
import One from '../views/One.vue'
import Two from '../views/Two.vue'

Vue.use(VueRouter)
const router = new VueRouter({
    // 配置路由的集合
    routes:[
        {
            path:"/",
            component:LoginUser,
            // 重定向
            redirect:"/two",
            children:[
                {path:"one",component:One,name:"one"},
                {path:"two",component:Two,name:"two"}

            ]
        },
        // {
            // 访问的路径
            // path:"/login",
            // 文件的路径
            // component:LoginUser,
            // children:[
            //     {path:'one',component:One},
            //     {path:'two',component:Two},
            // ]
        // },
        {
            name:'Home',
            path:"/home",
            alias:"/abc",//取别名
            meta:{
                title:"我是标题",
                msg:"我是返回的文本文字"
            },
            component:HomePage,
            // 值为对象
            // props:{a:'张三h', b:18 }
            // 值为布尔值
            // props:true
            // 函数写法
            // props({query}){
            //     return {
            //         mz:query.userName,
            //         nl:query.age
            //     }
            // }
        }
    ]
})
export default router